/**
 * 单机每日统计列表
 */

var single_day = new Object({
    table:null,
    init:function(){
        if(null != this.table)
            return;
        this.queryInfo();
        this.bindEvent();
    },
    queryInfo:function(){
        this.table = $('#tb_single_day_list').bootstrapTable({
            url: contextPath + '/statistics/single_day/listData.json',
            responseHandler: function (res) {
                return res.data;
            },
            queryParams: function (params) {
                params.singleDayStartDate = $('#singleDayStartDate').val();
                params.singleDayEndDate = $('#singleDayEndDate').val();
                return params;
            },
            pagination: true,
            pageList: '[10,20,50,100]',
            //showColumns: true,
            showRefresh: true,
            showToggle: true,
            //showPaginationSwitch:true,
            sidePagination: 'server',
            //striped:true,
            sortable: false,
            height: 700,
            search: true,
            searchAlign: 'left',
            toolbar: '' +
            '<div style="float:left;display: inline-flex;">' +
            '       <label style="display:inline;">时间范围：</label>' +
            '       <div class="input-daterange input-group" id="audit-datepicker-range">' +
            '           <input class="form-control" type="text" id="singleDayStartDate" placeholder="开始时间" />' +
            '           <span class="input-group-addon" style="width:10px;">to</span>' +
            '           <input class="form-control" type="text" id="singleDayEndDate" placeholder="结束时间" />' +
            '       </div>' +
            '</div>' +
            '<div style="float: left;margin-right:5px;">' +
            '    <button class="btn btn-default" type="button" onclick="single.doSearch()">' +
            '        <i style="margin-right:2px;" class="fa fa-search"></i>' +
            '        <span>查询</span>' +
            '    </button>' +
            '</div>',
            idField: 'id',
            uniqueId: 'id',
            //singleSelect: true,
            clickToSelect: true,
            columns: [{
                field: 'waWaMachine.code',
                title: '娃娃机编码',
                width: 100
            }, {
                field: 'waWaMachine.ip',
                title: '娃娃机IP',
                width: 80
            }, {
                field: 'statisticsDate',
                title: '统计时间',
                width: 200,
                formatter:function(value,row,index){
                    return (new Date(value)).Format("yyyy-MM-dd");
                }
            }, {
                field: 'playCount',
                title: '总局数',
                width: 100
            }, {
                field: 'success',
                title: '成功局数',
                width: 100
            }, {
                field: 'failed',
                title: '失败局数',
                width: 100
            }, {
                field: 'abnormal',
                title: '异常局数',
                width: 100
            }]
        });
        $('.search input').attr("placeholder", "娃娃机编码|IP");
    },
    doSearch:function(){
        single_day.table.bootstrapTable('refresh');
    },
    bindEvent: function () {
    }
});